UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Emj9JY//T0yfMyjWUJEm1PzyPiEd0dRu0eSsbVxdeI0='
WHERE
key_id = '2ec6d8cabd2a83f984f314e6b127609898c03b24f461866f4cd41304d420f321'
AND (
token = 'Emj9JY//T0yfMyjWUJEm1PzyPiEd0dRu0eSsbVxdeI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)