UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bser/ZdmHo3c8hOGr2vPIsEavQepja+nWAZVKcnVYgE='
WHERE
key_id = 'd440914a2f5ffa0ff125a6b9c1b1c28d88cfa65ecb71f8d799c00d7a7ed37736'
AND (
token = 'bser/ZdmHo3c8hOGr2vPIsEavQepja+nWAZVKcnVYgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)