UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oK8ZV6zvyR7G7QNTdzEIp0Y2qI9Wj10UanfYe6+F7NY=' 
WHERE 
  key_id = 'd0af17c236bf579c05821a102908309111dd254d8ef271cdc084c23b76f32a14' 
  AND (
    token = 'oK8ZV6zvyR7G7QNTdzEIp0Y2qI9Wj10UanfYe6+F7NY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044