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