UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C5NTrM3/K/ooWgCQqPvKvryN34xQ4ddYxYgmc0Riq6g=' 
WHERE 
  key_id = '6f9b0882304eb6fcc46b1c68147b0278aacb9ded318e447d279bab74ec2ef417' 
  AND (
    token = 'C5NTrM3/K/ooWgCQqPvKvryN34xQ4ddYxYgmc0Riq6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037