UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPm2TRJh7GuBxGK1iuZUK1lHf988R44tDL1SOfrsqr8=' 
WHERE 
  key_id = '069612ce0a6d204ae270b787959376a208c824c51fdb156a1cfaa779ed49e6d9' 
  AND (
    token = 'CPm2TRJh7GuBxGK1iuZUK1lHf988R44tDL1SOfrsqr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035