UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9g5ODyOWN1yDRAVqvD0nqwADMArUTxNhJlQmZQ9qOc='
WHERE
key_id = '7f99c1cec341a23d69f4ccd9ef2f5eeae8ff651aa41e5bf489e2baee404ae3c8'
AND (
token = 'G9g5ODyOWN1yDRAVqvD0nqwADMArUTxNhJlQmZQ9qOc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)