UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W/RQZyPEHGZ0lrijSTENKQLbM7vkHHZhSYHso7Hn8tk=' 
WHERE 
  key_id = 'd10de61be3bba55436078cdde20b5102923966a24295f54ef22f37d693870bb3' 
  AND (
    token = 'W/RQZyPEHGZ0lrijSTENKQLbM7vkHHZhSYHso7Hn8tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052