UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oA4qT3sPEHA05HpKNftFFP9UzLdICZd0yNzza3EDe7k='
WHERE
key_id = 'a39ad5a688f24bed2914d0cbdb0064a360ac16511732d12def1f1a4db9f95901'
AND (
token = 'oA4qT3sPEHA05HpKNftFFP9UzLdICZd0yNzza3EDe7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)