UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Id9P4Ssp8a6fcN36blfaXPyCGCODfHKGB7cWmt3oJKQ=' 
WHERE 
  key_id = 'd7e7bd0adf49191fd221a70d4a9f1bdfe0065196da48659921ddc3e2e0ab643d' 
  AND (
    token = 'Id9P4Ssp8a6fcN36blfaXPyCGCODfHKGB7cWmt3oJKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031