UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O/xWqljPJHgn0MXmVIKLD4CB4mVxX2LVqJgiCrPivVk='
WHERE
key_id = '98a27002e1480ad59a8e1c7e0031ac52861d3799f3e86336f2331f5a542c8ed5'
AND (
token = 'O/xWqljPJHgn0MXmVIKLD4CB4mVxX2LVqJgiCrPivVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)