UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gch0dnw/pRVrV1q4iloCKpNV3CPtBFa7rqwLw0VrmTk='
WHERE
key_id = '51a852a78ff966086cb135f104117086780ac9fa32e6dcf08b68ec792bd5e32c'
AND (
token = 'gch0dnw/pRVrV1q4iloCKpNV3CPtBFa7rqwLw0VrmTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)