UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XHD2Kx/ESvEOZEtSGFPjnGY5nXsUfTnbmh7TBGWiITk='
WHERE
key_id = '4001852db451784d8f0e29e247f3f23d3d6c369d4749d3e55549fb54314b098b'
AND (
token = 'XHD2Kx/ESvEOZEtSGFPjnGY5nXsUfTnbmh7TBGWiITk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)