UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4J1106YcyAropu0mpsH6U3HWLD5ZCp2FuRkRTXspEeY=' 
WHERE 
  key_id = '884cc732546bbb8e1963a5f3a4a30d3cc2279c202e4ce91628d7c1b3458bd13f' 
  AND (
    token = '4J1106YcyAropu0mpsH6U3HWLD5ZCp2FuRkRTXspEeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062