UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kdb4QjhAaXhHvALWtfbaDGjXAwj0wlKzXQ0T8wUPiOM=' 
WHERE 
  key_id = '8b75d150e2e1fd7ecef70c21037b2fb06a210d863ca0a075d1954e3556cbe454' 
  AND (
    token = 'Kdb4QjhAaXhHvALWtfbaDGjXAwj0wlKzXQ0T8wUPiOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00096