UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sGJD4DWubTmqjz6dr6YBn7pNQyhQIop2PJdTqsZsOoA='
WHERE
key_id = '6ca7a2ed77dd057eb011a3d7a8fadedd178a5145f604e8e09ba88aef1273100c'
AND (
token = 'sGJD4DWubTmqjz6dr6YBn7pNQyhQIop2PJdTqsZsOoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)