UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DXSc17zHdRbLeBD4GjpLl6o3/4MBAx+ppnLx+k/+/y8='
WHERE
key_id = 'b77b88200a093b51af0bfb6f2e8f42dbd2ce5b8fa0c361af3e7166480b20b747'
AND (
token = 'DXSc17zHdRbLeBD4GjpLl6o3/4MBAx+ppnLx+k/+/y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)