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