UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gf86IkghVCDkjUF6hG8m7XbI1tZSQRFfnSBn1hRnuKE=' 
WHERE 
  key_id = '3310eaf19579470202dc967dc322eba19354483fd86f93be734ce187cbd1cdb9' 
  AND (
    token = 'Gf86IkghVCDkjUF6hG8m7XbI1tZSQRFfnSBn1hRnuKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037