UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b4Ji6qBcNB3Rqq65aI43HB8jwSH8YpEawz6jQPbqFD8='
WHERE
key_id = '6e7d2065cf654236e00f5514199014ddd32dc0a25c93e37d8265b4441ea3dca3'
AND (
token = 'b4Ji6qBcNB3Rqq65aI43HB8jwSH8YpEawz6jQPbqFD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)