UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5QP0ADexhfEQF4PL3lHQhGs2ouPnmdH5t/kJy71sif4='
WHERE
key_id = 'b84dee783d4962d8118a45b49197702e35bb4d62ac6d0202c2a5e5cf71378ad2'
AND (
token = '5QP0ADexhfEQF4PL3lHQhGs2ouPnmdH5t/kJy71sif4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)