UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JG1S6VCQWH9GZkcHTKoTMkqEadv/Yn8jryl5gHZ1vfE=' 
WHERE 
  key_id = '87878dced839fa5aad5a16f77a8f83e7d929200c820cb8f228e1c1b534933958' 
  AND (
    token = 'JG1S6VCQWH9GZkcHTKoTMkqEadv/Yn8jryl5gHZ1vfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022