UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIlbC8i7dhcfvnRs4oSBD27C4vihj51XPsPEQlf6W48='
WHERE
key_id = '8806e9d714805effdc46f4b0a3d4955ccb62e0da2c5d0b964b4cc68d79fe5ac0'
AND (
token = 'dIlbC8i7dhcfvnRs4oSBD27C4vihj51XPsPEQlf6W48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)