UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fSfql+R5Hbt20/pzRZ1uBzKXxXPBeG2LPMkQfmWxCnM=' 
WHERE 
  key_id = 'ea1940a492c4ec08025a428959c2b02ad394c036250e37040eb745b8396b4157' 
  AND (
    token = 'fSfql+R5Hbt20/pzRZ1uBzKXxXPBeG2LPMkQfmWxCnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039