UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yv8165qJLSNmdUOS8dxGlcPxQ1I6CLUTmgNFcr5c7uw='
WHERE
key_id = '488d8b3a3647230385b8183b0614f87b993e18e7f93de722239b59b32a40616d'
AND (
token = 'yv8165qJLSNmdUOS8dxGlcPxQ1I6CLUTmgNFcr5c7uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)