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