UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'desohWmXujRy4JaOLxxmZ5LLcgQgx/UayIQavBLL6LI='
WHERE
key_id = 'b7d1cab581b4b9781480776b2e5927801bd45161a8525340ab974f2a8ccbf604'
AND (
token = 'desohWmXujRy4JaOLxxmZ5LLcgQgx/UayIQavBLL6LI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)