UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MgD0VXvSHvFKmtbHlenozXenPyA8BRMSgN6RCYKfAPc=' 
WHERE 
  key_id = '08e57c5618d94e2ba5970d936428e3141d42e30583b97f1abc459b3bec390f29' 
  AND (
    token = 'MgD0VXvSHvFKmtbHlenozXenPyA8BRMSgN6RCYKfAPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024