UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0MJ7jgjuZyKL8UHmC51eZar/zsjqW9B3vJ0uLveJ0kk='
WHERE
key_id = '6bfcc48c6a14caf0c0922150f20f8ab8936cc35b7e20a985ac9703787630bd03'
AND (
token = '0MJ7jgjuZyKL8UHmC51eZar/zsjqW9B3vJ0uLveJ0kk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)