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