UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D5YfDQEWtkcBhQ90pUUrOaCcrC5xQ6LyCin9i8v30fk='
WHERE
key_id = '3a37391abcd1fc51817bf9bef6faf384b70912938a542702343cfca6f31b4f8b'
AND (
token = 'D5YfDQEWtkcBhQ90pUUrOaCcrC5xQ6LyCin9i8v30fk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)