UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZrX1D3t/D4+F2tapWil+5qpaKQxa74U5pBWxn5imWu8='
WHERE
key_id = 'c47a4c94b7fcec8bd3b92734db5683b5fb03a66343cca8ed49401cc66bb30d00'
AND (
token = 'ZrX1D3t/D4+F2tapWil+5qpaKQxa74U5pBWxn5imWu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)