UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7G6afzgTdCtpp9JQ0/8Op6oKGS1ymDvgANjFGEi7smI='
WHERE
key_id = '6edf305278c232f88fc3214e2c0613d853d7901a698a4b50ecaea2dcc7909474'
AND (
token = '7G6afzgTdCtpp9JQ0/8Op6oKGS1ymDvgANjFGEi7smI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)