UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSacQO8TRZnhrzKTkT4CqR1mluk/PWhOCGy207vjbPA=' 
WHERE 
  key_id = '785810ca10540e63c0dbe240f7f93a82c2a7978ce7916533457b6abff9b10219' 
  AND (
    token = 'mSacQO8TRZnhrzKTkT4CqR1mluk/PWhOCGy207vjbPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045