UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0hqdIvj1SdHkpviArgusv7kw6CJw/dhQkki62pwIE/o='
WHERE
key_id = 'ddf05222cecbcba93cd72c01e37c00fb17834b5532b9b3c0be244b144254bb50'
AND (
token = '0hqdIvj1SdHkpviArgusv7kw6CJw/dhQkki62pwIE/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)