UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xg2kZEqkk/d9emo8e36sJO6JeobNUlSFVpzPldBaROw=' 
WHERE 
  key_id = '4a8dec42251364f5f89bb32b326709769d6f1de1e972c25fb390a8d7b503bdb1' 
  AND (
    token = 'xg2kZEqkk/d9emo8e36sJO6JeobNUlSFVpzPldBaROw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016