UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RBBQZq6dN5ea//X1H/nohUocKR4Y/zOvQFLzcZd6zxM='
WHERE
key_id = '417c34db8f2bde00e061bf7441af88954d570594e083716e1a2240134eb66a2b'
AND (
token = 'RBBQZq6dN5ea//X1H/nohUocKR4Y/zOvQFLzcZd6zxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)