UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm4yEP5C5jfHG3QsNW34Tyzc8pLwCCNX3LI6v5ioxzDQ='
WHERE
key_id = '9ffea905ac22da81e47c5adec279da4ff52046e3358812447bc960b2b94f58d4'
AND (
token = 'm4yEP5C5jfHG3QsNW34Tyzc8pLwCCNX3LI6v5ioxzDQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)