UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N4rSUC8+5bzqqeBRf8fe0v7bV4/gK6VJoI6nm3XJEis='
WHERE
key_id = 'f42cea532b5402bcea2ca9bbf2a4391f1eb908fee45274c80ef68d46820799fc'
AND (
token = 'N4rSUC8+5bzqqeBRf8fe0v7bV4/gK6VJoI6nm3XJEis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)