UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ed+Vs+YhOJQhq4PbiHUEA+FSIhjUqqtgprjc+RTPA40=' 
WHERE 
  key_id = '8c025e623c8f1150a411fb94d9c3e1a4c61dbcd81aebfe704065ae1a3d9bace8' 
  AND (
    token = 'ed+Vs+YhOJQhq4PbiHUEA+FSIhjUqqtgprjc+RTPA40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015