UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WTO+knUwtQij8zy9xqtuiNPFzBsg9mLberGCpZRGYI8=' 
WHERE 
  key_id = 'a480def020c2604921e3d356405ca2931d62c16ef2cdba924eb26dfea9bf9eb8' 
  AND (
    token = 'WTO+knUwtQij8zy9xqtuiNPFzBsg9mLberGCpZRGYI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032